import Vue from 'vue'
import VueRouter from 'vue-router'
// 一级路由
import citList from '@/views/citList'
import Collect from '@/views/collect'
import Login from '@/views/login'
import Home from '@/views/home'
import My from '@/views/my'
import Details from '@/views/details'
// 二级路由
import Layout from '@/views/layout'
import Find from '@/views/find'
import News from '@/views/news'
import User from '@/views/user'
import Notfound from '@/views/notFound'
Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    { path: '/citList', component: citList },
    { path: '/collect', component: Collect },
    { path: '/', redirect: '/home' },
    { path: '/login', component: Login },
    { path: '/details', component: Details },
    {
      path: '/home',
      component: Layout,
      redirect: '/home/first',
      children: [
        { path: 'first', component: Home },
        { path: 'find', component: Find },
        { path: 'news', component: News },
        { path: 'user', component: User }
      ]
    },
    { path: '/my', component: My },
    { path: '/resources', component: () => import('@/views/resources.vue') },
    { path: '/Map-search', component: () => import('@/views/Map-search') },
    { path: '*', component: Notfound }
  ]
})

export default router
